<% content_for :sidebar do %>
  <%= sidebar_button_link 'New Department', new_department_path if can? :create, Department %>
<% end %>

<table id="departments" class="generic_datatable table table-striped table-bordered">
  <caption><h3><%= @page_title %></h3></caption>
  <thead>
    <tr>
      <th>Name</th>
      <th>Status</th>
      <th>Contact</th>
      <th>Description</th>
      <th>Manage People</th>
      <th>Manage Items</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @departments.each do |department| %>
      <tr>
        <td><%= link_to department.name,  department%></td>
        <td><%= department.status %></td>
        <td><%= department.contact_id %></td>
        <td><%= department.description %></td>
        <td><%= department.manage_people %></td>
        <td><%= department.manage_items %></td>
        <td><%= table_button_link 'Edit', edit_department_path(department) %></td>
      </tr>
    <% end %>
  </tbody>
</table>
